import request from "@/utils/request";

/**
 * 新增账号
 * @param data
 * @returns {Promise<AxiosResponse<any>>}
 */
export function createAccount(data) {
    return request({
        url: '/sys/account/create',
        method: 'post',
        data
    });
}

/**
 * 删除账号
 * @param uid
 * @returns {Promise<AxiosResponse<any>>}
 */
export function removeAccount(uid) {
    return request({
        url: '/sys/account/delete/' + uid,
        method: 'get'
    });
}

/**
 * 更新账号
 * @param data
 * @returns {Promise<AxiosResponse<any>>}
 */
export function updateAccount(data) {
    return request({
        url: '/sys/account/update',
        method: 'post',
        data
    });
}

/**
 * 分配角色
 * @param data
 * @returns {Promise<AxiosResponse<any>>}
 */
export function assignRoleToUser(data) {
    return request({
        url: '/sys/account/assignRoleToUser',
        method: 'post',
        data
    });
}

/**
 * 分页查询
 * @param params
 * @returns {Promise<AxiosResponse<any>>}
 */
export function queryPage(params) {
    return request({
        url: '/sys/account/queryPage',
        method: 'get',
        params
    });
}
